package com.wanmait.wanmarecruit.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wanmait.wanmarecruit.service.ProvinceService;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wanmait.wanmarecruit.entity.Province;
import com.wanmait.wanmarecruit.mapper.ProvinceMapper;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class ProvinceServiceImpl extends ServiceImpl<ProvinceMapper, Province> implements ProvinceService {

    @Override
    public List<Province> getAllProvinces() {
        LambdaQueryWrapper<Province> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.select(Province::getProvName,Province::getProvId);
        queryWrapper.orderByAsc(Province::getSort);
        return this.list(queryWrapper);
    }

    @Override
    public List<Province> getProvincesBySort() {
        LambdaQueryWrapper<Province> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByAsc(Province::getSort);
        return this.list(queryWrapper);
    }
}
